package com.haierCamera.customapplication.ui.main.widget;

import android.content.Context;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Toast;

import com.haierCamera.customapplication.R;
import com.haierCamera.customapplication.utils.DensityUtil;

import androidx.constraintlayout.widget.ConstraintLayout;

public class ToastBindSuccess extends Toast {
    private static Toast mToast;

    public ToastBindSuccess(Context context) {
        super(context);
    }

    public static void showToast(Context context) {

        //获取系统的LayoutInflater
        LayoutInflater inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View view = inflater.inflate(R.layout.hzkl_dialog_device_bind_success, null);

        view.setBackground(context.getResources().getDrawable(R.drawable.hzkl_dialog_bind_success_bg));
        view.setAlpha(0.6f);
        //实例化toast
        mToast = new Toast(context);
        mToast.setDuration(Toast.LENGTH_SHORT);
        mToast.setGravity(Gravity.CENTER,0,0);
        mToast.setView(view);
        mToast.show();
    }

}
